<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>首页</title>
    {include file='common/require'/}
    <script>
        var currentLeftNavItem = 'channel'
    </script>
</head>

<body>

    {include file='common/left_menu'/}

    <div class="main-container">
        <div class="main-header">
            <span class="layui-breadcrumb">
                <a href="">首页</a>
                <a href="">隧道管理</a>
                <a href="">端口隧道</a>
                <a href=""><cite>编辑隧道</cite></a>
            </span>
        </div>

        <div class="main-body">
            <div>
                <blockquote class="layui-elem-quote">修改配置信息，编辑隧道。</blockquote>
            </div>
            <div class="control-container">
                <div class="layui-btn-container">

                </div>
                <div class="right-container">

                </div>
            </div>
            <div>
                <div class="layui-row">

                    <form class="layui-form layui-col-md6" action="{:url('update',['id'=>$channel.id])}" method="POST" lay-filter="*"> 
                        <div class="layui-form-item">
                            <label class="layui-form-label">名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="name" required lay-verify="required" value="{$channel.name}" placeholder="请输入名称"
                                    autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">客户端</label>
                            <div class="layui-input-block">
                                <input type="hidden" name="client_id" value="{$channel.client.id}">
                                <input type="text" name="" value="{$channel.client.name}" readonly class="layui-input">
                                <div class="layui-word-aux">
                                    {$channel.client.comment}
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">协议</label>
                            <div class="layui-input-block">
                                <input type="radio" name="type" required lay-verify="required"  value="1" title="TCP">
                                <input type="radio" name="type" required lay-verify="required"  value="2" title="UDP">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">服务端口</label>
                            <div class="layui-input-inline">
                                <input type="text" name="server_port" required lay-verify="required"  value="{$channel.server_port}" class="layui-input">
                                <div class="layui-form-mid layui-word-aux">
                                    <span class="text-button">检查</span> 服务端占用的端口。 
                                </div>
                            </div>
                            
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">目标IP</label>
                            <div class="layui-input-block">
                                <input type="text" name="local_target_ip" required lay-verify="required"  value="{$channel.local_target_ip}" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">目标端口</label>
                            <div class="layui-input-inline">
                                <input type="text" name="local_target_port" required lay-verify="required"  value="{$channel.local_target_port}" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">状态</label>
                            <div class="layui-input-block">
                                <input type="radio" name="status" value="0" required lay-verify="required"  title="正常">
                                <input type="radio" name="status" value="1" required lay-verify="required"  title="禁用">
                            </div>
                        </div>
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">备注</label>
                            <div class="layui-input-block">
                                <textarea name="comment" placeholder="请输入备注" class="layui-textarea">{$channel.comment}</textarea>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn layui-btn-normal" type="submit">保存</button>
    
                            </div>
                        </div>
                    </form>
                </div>

            </div>
        </div>
    </div>
    {include file='common/footer'/}

    <script>
        layui.use('form', function () {
            var form = layui.form;

            form.val('*',{
                'type':'{$channel->getData("type")}',
                'status':'{$channel->getData("status")}',
            })
        });
    </script>

</body>

</html>